<template>
	<view class="add page c00">
		<view class="bgf7 p12">
			<view class="bgff px14 pb10">
				<view class="flex flexC borb py12" >
					<text class="flex1">优惠券</text>
					<text class="py3">{{name}}</text>
					<text class="arrowR ml3"></text>

				</view>
				<view class="flex flexC  py12" >
					<text class="flex1">用户手机号</text>
					<input v-model="mobile" placeholder="赠送的用户手机号" />

				</view>


				<view class="flex flexC flexJC py20">
					<view class="aliC py12 w-17 bgff0 r40" @click="send">发送</view>
				</view>



			</view>
		</view>



	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				
				id:'',
				name:'',
				mobile:''
			};
		},
		onLoad(option) {

			this.id = option.id;
			this.name = option.name;
		},

		onShow() {

		},
		methods: {

	
			send() {
				let that = this;
				let param = {
					id: this.id,
					mobile: this.mobile
				}
				this.$api.sendCoupon(param).then(res => {

					if (res.code == 1) {
						uni.showModal({
							title:"提示",
							content:"发放成功",
							showCancel:false,
							confirmText:"确定",
							complete(res){
								if(res.confirm == true){
									uni.navigateBack({
										delta:1
									})
								}
							}
						})
					} else {
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				})

			},


		}
	}
</script>

<style lang="scss" scoped>
	.add {
		.w48 {
			width: 96rpx;
			height: 96rpx;
		}

		.imgbox {
			width: 164rpx;
			height: 164rpx;
			background-color: #E8E8E8;
			position: relative;

			image {
				width: 100%;
				height: 100%;
			}

			.del {
				width: 36rpx;
				height: 36rpx;
				background: rgba(181, 180, 180, .8);
				position: absolute;
				top: -12rpx;
				right: -12rpx;
			}
		}
	}

	.popup-content2 {
		background: #FFFFFF;

		.popup-btn {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
			border-bottom: 1px solid #f5f5f5;
			background: #FFFFFF;
		}

		.button {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
			border-bottom: 1px solid #f5f5f5;
			background: #FFFFFF;
			font-size: 11pt;
		}

		button::after {
			border: none;
		}

		.pt20 {
			border-bottom: 20rpx solid #f5f5f5;
		}
	}
</style>